/*
 * @Author: lys
 * @Description: 
 * @Date: 2024-02-22 19:10:40
 * @LastEditors: lys
 * @LastEditTime: 2024-05-21 00:30:49
 */
// with polyfills
import 'core-js/stable'
import 'regenerator-runtime/runtime'

import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store/'
import { VueAxios } from './utils/request'
import ProLayout, { PageHeaderWrapper } from '@ant-design-vue/pro-layout'
import themePluginConfig from '../config/themePluginConfig'
import { Tree, Button, Input, Image } from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import Updater from "./utils/AutoUpdate.js"
// mock
// WARNING: `mockjs` NOT SUPPORT `IE` PLEASE DO NOT USE IN `production` ENV.
// import './mock'

import bootstrap from './core/bootstrap'
import './core/lazy_use' // use lazy load components
import './permission' // permission control
import './utils/filter' // global filter
import './global.less' // global style
import './variable.less' // global style

import { fileDownLoad } from '@/utils/util'
Vue.prototype.$fileDownLoad = fileDownLoad

Vue.config.productionTip = false

// mount axios to `Vue.$http` and `this.$http`
Vue.use(VueAxios)
Vue.use(Tree)
Vue.use(Button)
Vue.use(Input)
Vue.use(Image)
// use pro-layout components
Vue.component('pro-layout', ProLayout)
Vue.component('page-container', PageHeaderWrapper)
Vue.component('page-header-wrapper', PageHeaderWrapper)

window.umi_plugin_ant_themeVar = themePluginConfig.theme

//前端重新部署通知用户刷新网页
const AutoUpdate = new Updater()
AutoUpdate.on('update',()=>{
  setTimeout(async()=>{
      const result = confirm('当前网站有更新，请点击确定刷新页面');
      if(result){
        location.reload();
      }
  }, 2000)
})


new Vue({
  router,
  store,
  // init localstorage, vuex, Logo message
  created: bootstrap,
  render: h => h(App)
}).$mount('#app')
